//
//  NSString+ZJAddition.m
//  QQ_Chat_UI
//
//  Created by ZJ on 2018/7/31.
//  Copyright © 2018年 iCatch Technology Inc. All rights reserved.
//

#import "NSString+ZJAddition.h"

@implementation NSString (ZJAddition)

- (CGSize)sizeOfTextWithMaxSize:(CGSize)maxSize font:(UIFont *)font {
    NSDictionary *attr = @{
                           NSFontAttributeName: font,
                           };
    
    return [self sizeOfTextWithMaxSize:maxSize attributes:attr];
}

- (CGSize)sizeOfTextWithMaxSize:(CGSize)maxSize attributes:(nullable NSDictionary<NSAttributedStringKey, id> *)attributes {
    return [self boundingRectWithSize:maxSize options:NSStringDrawingUsesLineFragmentOrigin attributes:attributes context:nil].size;
}

@end
